package com.dferreira.repository.data_models;

import com.j256.ormlite.field.DatabaseField;

public class PackageCommon {
    public static final String COLUMN_NAME_ID = "id";
    public static final String COLUMN_NAME_NAME = "name";
    public static final String COLUMN_NAME_DESCRIPTION = "description";
    public static final String COLUMN_NAME_VERSION = "version";
    public static final String COLUMN_NAME_AUTHOR = "author";
    public static final String COLUMN_NAME_COMPRESSED_SIZE = "compressed_size";
    public static final String COLUMN_NAME_UNCOMPRESSED_SIZE = "uncompressed_size";
    public static final String COLUMN_NAME_URL = "url";
    public static final String COLUMN_NAME_REPOSITORY = "repository_id";



    @DatabaseField(generatedId = true, columnName = COLUMN_NAME_ID)
    private Integer id;
    @DatabaseField(columnName = PackageCommon.COLUMN_NAME_NAME, canBeNull = false)
    private String name;
    @DatabaseField(columnName = PackageCommon.COLUMN_NAME_DESCRIPTION, canBeNull = false)
    private String description;
    @DatabaseField(columnName = PackageCommon.COLUMN_NAME_VERSION, canBeNull = false)
    private Integer version;
    @DatabaseField(columnName = PackageCommon.COLUMN_NAME_AUTHOR, canBeNull = false)
    private String author;
    @DatabaseField(columnName = PackageCommon.COLUMN_NAME_COMPRESSED_SIZE, canBeNull = false)
    private Long compressedSize;
    @DatabaseField(columnName = PackageCommon.COLUMN_NAME_UNCOMPRESSED_SIZE, canBeNull = false)
    private Long uncompressedSize;
    @DatabaseField(columnName = PackageCommon.COLUMN_NAME_URL, canBeNull = true)
    private String url;

    @DatabaseField(foreign = true, columnName = COLUMN_NAME_REPOSITORY)
    private Repository repository;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Long getCompressedSize() {
        return compressedSize;
    }

    public void setCompressedSize(Long compressedSize) {
        this.compressedSize = compressedSize;
    }

    public Long getUncompressedSize() {
        return uncompressedSize;
    }

    public void setUncompressedSize(Long uncompressedSize) {
        this.uncompressedSize = uncompressedSize;
    }

    public String getUrl() {
        // probably I need TODO was done the set of this argument in the save but probably exists a better place
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Repository getRepository() {
        return repository;
    }

    public void setRepository(Repository repository) {
        this.repository = repository;
    }

    @Override
    public String toString() {
        return "RepositoryPackage [name=" + name + ", description="
                + description + ", version=" + version + ", author=" + author
                + ", compressedSize=" + compressedSize + ", uncompressedSize="
                + uncompressedSize + ", url=" + url + "]";
    }

}
